// pages/firstpage/firstpage.js
import {
  ApiRootUrl
} from '../../config/index.js'
import Dialog from '../../@vant/weapp/dialog/dialog';
import Toast from '../../@vant/weapp/toast/toast';
import {
  IMG_PATH
} from '../../config/index.js'
import {login} from "../../utils/util"
Page({

  /**
   * 页面的初始数据
  */
  data: {
    loginBtn:`(${IMG_PATH}/newImg/sqdl.png)`,
    rzsqBtn:`(${IMG_PATH}/newImg/rzsq.png)`,
    showUserList:false,
    userList:[],
    userinfo: '',
    bgUrl5:`${IMG_PATH}/personalcenter/bg.png`,
    message:"会话已过期！请重新登录！",
    userType:4, //人员类型:0待面试务工人员;1在职务工人员;2在职非务工人员;3离职务工人员;4游客;
    tishiShow: false,
    bgUrl: `${IMG_PATH}/xyt_bg.png`,
    bgUrl2: `${IMG_PATH}/newImg/newBg.jpg`,
    headUrl: `${IMG_PATH}/personalcenter/touxiang.png`,
    personUrl: `${IMG_PATH}/personalcenter/wodejianli.png`,
    dengjiUrl:`${IMG_PATH}/personalcenter/zanzhudengji.png`,
    myUrl: `${IMG_PATH}/personalcenter/gongzuoxinxi.png`,
    dingdanUrl: `${IMG_PATH}/personalcenter/wodedingdan.png`,
    scUrl: `${IMG_PATH}/center/我的收藏.png`,
    infoUrl: `${IMG_PATH}/center/我的信息.png`,
    yinghangUrl: `${IMG_PATH}/personalcenter/wodeyinhangka.png`,
    commonUrl: `${IMG_PATH}/center/常见问题.png`,
    jianliUrl: `${IMG_PATH}/center/我的简历.png`,
    yijianUrl: `${IMG_PATH}/personalcenter/yijianfankui.png`,
    shanchengUrl: `${IMG_PATH}/personalcenter/anquanpingce.png`,
    shouyeUrl: `${IMG_PATH}/main-page/首页.png`,
    guanzhuUrl: `${IMG_PATH}/main-page/关注.png`,
    saoUrl: `${IMG_PATH}/main-page/扫一扫.png`,
    maininfoUrl: `${IMG_PATH}/main-page/信息.png`,
    mainselfUrl: `${IMG_PATH}/main-page/我的.png`,
    IMG_PATH: IMG_PATH,
    active: 1,
    loginFlag: false,
    hotList: [{
        pic: `${IMG_PATH}/personalcenter/wodetuangou.png`
      }, {
        pic: `${IMG_PATH}/personalcenter/jielong.png`
      }, {
        pic: `${IMG_PATH}/personalcenter/duobao.png`
      }, {
        pic: `${IMG_PATH}/personalcenter/mianxi.png`
      }]
  },
  personcenterClick() {
    wx.navigateTo({
      url: '../personcenter/personcenter',
    })
  },
  
  getPhoneNumber(e) {
    let self = this;
    let flag = true;
    wx.checkSession({
      success: function (res) {
        console.log('session_key未过期')
        //session_key未过期
        flag = true;
      },
      fail: function (res) {
        flag = false;
        self.setData({
          tishiShow: true
        })
      }
    })
    if (!flag) {
      return;
    }
    let openId = wx.getStorageSync("openId");
    if (e.detail.errMsg == 'getPhoneNumber:ok') {
      let url = `${ApiRootUrl}/index/grantPhone`;
      let params = {
        iv: e.detail.iv,
        encryptedData: e.detail.encryptedData
      }
      Toast.loading({
        message: '加载中...',
        mask: true,
        duration: 0,
        forbidClick: true,
      });
      wx.request({
        url: url,
        method: 'GET',
        header: {
          'content-type': 'application/json; charset=utf-8',
          'cookie': wx.getStorageSync("sessionid")
        },
        params: params,
        data: params,
        success(res) {
          Toast.clear();
          if (res.data.code == 20000) {
            let phoneNumber = res.data.data;
            wx.setStorageSync("phoneNumber", phoneNumber);
            if(self.data.type == 0){
              let userinfo = wx.getStorageSync('userinfo');
              if(userinfo){
                self.checkRegister(userinfo.componentCode,self.data.code);
              }else{
                wx.redirectTo({
                  url: `../register/register?componentType=${self.data.type}&OrgCode=${self.data.code}&orgName=${self.data.name}`,
                })
              }
            }
            if(self.data.type == 1){
              self.checkRegister(self.data.code,"");
            }
            // self.setData({
            //   loginFlag:true
            // })
          } else if (res.data.code == 30000) {
            self.setData({
              tishiShow: true
            })
          }else if (res.data.code == 30002) {
            self.setData({
              loginFlag:false
            })
          } else {
            Toast({
              duration: 3000,
              forbidClick: true,
              type: 'fail',
              message: res.data.message,
            });
          }
        },
        fail(res) {
          Toast.clear();
          Toast({
            duration: 3000,
            forbidClick: true,
            type: 'fail',
            message: '网络已断开',
          });
        }
      })
      // this.setData({
      //   loginFlag:true
      // })
    } else {
      Toast({
        duration: 3000,
        forbidClick: true,
        type: 'fail',
        message: '不授权将无法登录该小程序！',
      });
    }
  },

  checkRegister(componentCode,labourCode) {
    let self = this;
    let openId = wx.getStorageSync("openId");
    let url = `${ApiRootUrl}/index/checkRegisterLabourWorker?openId=${openId}&labourCode=${labourCode}&componentCode=${componentCode}`;
    // Toast.loading({
    //   message: '加载中...',
    //   mask: true,
    //   duration: 0,
    //   forbidClick: true,
    // });
    wx.showLoading({
      title: '加载中...',
    })
    wx.request({
      url: url,
      method: 'GET',
      header: {
        'content-type': 'application/json; charset=utf-8',
        'cookie': wx.getStorageSync("sessionid")
      },
      success(res){
        // Toast.clear();
        wx.hideLoading()
        console.log("res====>111111",res)
        if (res.data.code == 20000) {
          wx.setStorageSync('userinfo', res.data.data)
          //  usertype
          // 0待面试务工人员;1在职务工人员;2在职非务工人员;3离职务工人员;4游客
          console.log("usertype",res.data.data.userType)
          self.setData({
            loginFlag: true,
            userType:Number(res.data.data.userType),
            userinfo:res.data.data
          })
          console.log("接口返回数据=====>：", res.data.data)
        } else if (res.data.code == 30000) {
          let phone = wx.getStorageSync('phoneNumber')
          if(phone){
            wx.redirectTo({
              url: `../register/register?componentType=${self.data.type}&OrgCode=${self.data.code}&orgName=${self.data.name}`,
            })
          }
          
          
        } else if (res.data.code == 30002) {
          let phone = wx.getStorageSync('phoneNumber')
          if(phone){
            wx.redirectTo({
              url: `../register/register?componentType=${self.data.type}&OrgCode=${self.data.code}&orgName=${self.data.name}`,
            })
          }
          
        }else if (res.data.code == 30001) {
          self.setData({
            tishiShow:true,
            message:res.data.message
         })
        } else {
          Toast({
            duration: 3000,
            forbidClick: true,
            type: 'fail',
            message: res.data.message,
          });
        }
        // Toast.clear();
      },
      fail(res) {
        // Toast.clear();
        wx.hideLoading()
        Toast({
          duration: 3000,
          forbidClick: true,
          type: 'fail',
          message: '网络已断开',
        });
      }
    })
  },
  isCanbaoConfirm(e){
    let self=this
    console.log(e);
    let data=e.detail.value
    self.newLogin(data)
    if (!data.user) {
      self.setData({
              showUserList:false,
              loginFlag: true,
            userType:Number(data.userType),
            userinfo:data
            },
          //   wx.showModal({
          //     title: '温馨提示',
          //     content: '服务号需要在必要时向您发送消息',
          //     confirmText:"同意",
          //     cancelText:"拒绝",
          //     success: function (res) {
          //         if (res.confirm) {
          //            //调用订阅消息
          //             console.log('用户点击确定');
          //             //调用订阅
          //             self.getMessage();
          //         } else if (res.cancel) {
          //             console.log('用户点击取消');
          //             ///显示第二个弹说明一下
          //             wx.showModal({
          //               title: '温馨提示',
          //               content: '拒绝后您将无法获取实时的消息通知',
          //               confirmText:"知道了",
          //               showCancel:false,
          //               success: function (res) {
          //                 ///点击知道了的后续操作 
          //                 ///如跳转首页面 
          //               }
          //           });
          //         }
          //     }
          // })
          )
    }else{
       // 有user表示是非劳务工
       if (data.user.typeCode == 'business') {
        wx.redirectTo({
          url: '/pages/companyfirstpage/companyfirstpage',
        })
      } else if (data.user.typeCode == 'labour') {
        wx.redirectTo({
          url: '/pages/laborcompany/firstpage/firstpage',
        })
      }
    }
  },
  isCanbaoCancel(){
    let self=this
    this.setData({
      showUserList:false
    })
    wx.showModal({
      title: '提示',
      content: '您已注册过心园通小程序,是否重新注册?',
      cancelText:"进入系统",
      confirmText:"重新注册",
      success (res) {
        if (res.confirm) {
          wx.redirectTo({
          url: `../register/register?componentType=${self.data.type}&OrgCode=${self.data.code}&orgName=${self.data.name}`,
        })
        } else if (res.cancel) {
          self.setData({
            // userList:userList,
            showUserList:true
          })
        }
      }
    })
  },
  newCheckUser() {
    let self = this;
    let openId = wx.getStorageSync("openId");
    let url = `${ApiRootUrl}/index/newCheckUser?openId=${openId}`;
    // Toast.loading({
    //   message: '加载中...',
    //   mask: true,
    //   duration: 0,
    //   forbidClick: true,
    // });
    wx.showLoading({
      title: '加载中...',
    })
    wx.request({
      url: url,
      method: 'GET',
      header: {
        'content-type': 'application/json; charset=utf-8',
        'cookie': wx.getStorageSync("sessionid")
      },
      success(res){
        // Toast.clear();
        wx.hideLoading()
        console.log("res====>111111",res)
        if (res.data.code == 20000) {
        console.log('注册过小程序',res.data.data);
        let userList=res.data.data
        userList.forEach((item)=>{
          if(item.userType==0){
            item.text='待面试-'+item.componentName
          }
          if(item.userType==1){
            item.text='在职务工人员-'+item.componentName
          }
          if(item.userType==2&&item.componentName){
            item.text='在职管理人员-'+item.componentName
          }
          if(item.userType==2&&!item.componentName){
            item.text=item.user.roleName
          }
          if(item.userType==3){
            item.text='离职务工人员-'+item.componentName
          }
          if(item.userType==4){
            item.text='游客'
          }
          if(item.userType==5){
            item.text='外协-'+item.componentName
          }
          if(item.userType==7){
            item.text='未入职申请务工人员-'+item.componentName
          }
        })
        wx.showModal({
          title: '提示',
          content: '您已注册过心园通小程序,是否重新注册?',
          cancelText:"进入系统",
          confirmText:"重新注册",
          success (res) {
            if (res.confirm) {
              wx.redirectTo({
              url: `../register/register?componentType=${self.data.type}&OrgCode=${self.data.code}&orgName=${self.data.name}`,
            })
            } else if (res.cancel) {
              self.setData({
                userList:userList,
                showUserList:true
              })
            }
          }
        })
        } else if (res.data.code == 30000) {
          let phone = wx.getStorageSync('phoneNumber')
          if(phone){
            wx.redirectTo({
              url: `../register/register?componentType=${self.data.type}&OrgCode=${self.data.code}&orgName=${self.data.name}`,
            })
          }
          
          
        } else if (res.data.code == 30002) {
          let phone = wx.getStorageSync('phoneNumber')
          if(phone){
            wx.redirectTo({
              url: `../register/register?componentType=${self.data.type}&OrgCode=${self.data.code}&orgName=${self.data.name}`,
            })
          }
          
        }else if (res.data.code == 30001) {
          self.setData({
            tishiShow:true,
            message:res.data.message
         })
        } else {
          Toast({
            duration: 3000,
            forbidClick: true,
            type: 'fail',
            message: res.data.message,
          });
        }
        // Toast.clear();
      },
      fail(res) {
        // Toast.clear();
        wx.hideLoading()
        Toast({
          duration: 3000,
          forbidClick: true,
          type: 'fail',
          message: '网络已断开',
        });
      }
    })
  },
  closeUserList(){
    let self=this
    this.setData({
      showUserList:false
    })
    wx.showModal({
      title: '提示',
      content: '您已注册过心园通小程序,是否重新注册?',
      cancelText:"进入系统",
      confirmText:"重新注册",
      success (res) {
        if (res.confirm) {
          wx.redirectTo({
          url: `../register/register?componentType=${self.data.type}&OrgCode=${self.data.code}&orgName=${self.data.name}`,
        })
        } else if (res.cancel) {
          self.setData({
            // userList:userList,
            showUserList:true
          })
        }
      }
    })
  },
  onChangeUser(e){
console.log(e);
  },
  tabClick(event) {
    console.log(event);
    let id = event.currentTarget.dataset.id;
    if (id == 3) {
      var that = this;
      //调用扫码功能
      wx.scanCode({
        success: (res) => {
          console.log("扫一扫获取：", res);
          // that.setData({
          //   deviceName: res.result
          // })
          //获取到二维码中的蓝牙设备名后跳转到连接页面
          // var title = that.data.deviceName;
          var path=res.path
          // wx.redirectTo({
          //   url: '../detail/detail?id=' + title
          // })
          wx.navigateTo({
            url: '/'+path
          })
        },
        fail: (res) => {
          wx.showToast({
            title: '扫码失败',
            icon: 'success',
            duration: 2000
          })
        },
      })
    } else if(id == 2){
      wx.navigateTo({
        url: './message/index',
      })
    }else if(id == 4){
      wx.navigateTo({
        url: './message/index',
      })
    } else{
      this.setData({
        active: id
      })
    }

  },
  jianliClick() {
    wx.navigateTo({
      url: '../notes/notes',
    })
  },
  infoclick() {
    wx.navigateTo({
      url: '../infomation/infomation',
    })
  },
  zanzhuClick() {
    // return
    // Toast.fail('开发中，敬请期待')
    // return
    wx.navigateTo({
      url: './zanzhu/index',
    })
  },
  toMyCard() {
    wx.navigateTo({
      url: './mycard/index',
    })
  },
  toBtn(e){
    let self=this
    if(e.currentTarget.dataset.index == "3"){
      wx.navigateToMiniProgram({
        appId: 'wxe8cec4b2f7c8e812',
        path: `src/pages/takeaway/index?inviteCode=damai&extid=${this.data.userinfo.openId}&extappid=wx892d877d9306f4bf&extpatch=pages/authorizedPage/authorizedPage`,
        extraData: {},
        envVersion: 'release',
        success(res) {
          // 打开成功
          console.log(res)
        },
        fail(err){
          console.log(err)
        }
      })
    }else if(e.currentTarget.dataset.index == "14"){
      wx.navigateTo({
        url: './feedback/index',
      })
    }else if(e.currentTarget.dataset.index == "1"){
      // return
      wx.navigateTo({
        url: './kaifaqu/index',
      })
    }else if(e.currentTarget.dataset.index == "5"){
      wx.navigateTo({
        url: './safe/index',
      })
    }else if(e.currentTarget.dataset.index == "4"){
      wx.navigateTo({
        url: './message/index',
      })
    }else if(e.currentTarget.dataset.index == "9"){
      return
      wx.showModal({
        title: "提示",
        content: "暂未开放",
        showCancel:false,
        success (res) {
          if (res.confirm) {
            
          } else if (res.cancel) {
            
          }
        }
      })
      return
      wx.navigateTo({
        url: './xuanshang/index',
      })
    }else if(e.currentTarget.dataset.index == "6"){
      // this.getZptz()
      // return
      // wx.showModal({
      //   title: "提示",
      //   content: "暂未开放",
      //   showCancel:false,
      //   success (res) {
      //     if (res.confirm) {
            
      //     } else if (res.cancel) {
            
      //     }
      //   }
      // })
      // return
      // if(self.data.userinfo.userType==1){
      //   Toast.fail('仅未入职人员可用')
      //   return
      // }else{
      //   wx.navigateTo({
      //     url: '../../recruitmentest/pages/recruitment/queryList/queryList',
      //   })
      // }
      wx.navigateTo({
        url: '../../recruitmentest/pages/recruitment/queryList/queryList',
      })
      
    }else if(e.currentTarget.dataset.index == "2"){
      return
      wx.navigateTo({
        url: './money/index',
      })
    }else{
      return
      wx.showModal({
        title: "提示",
        content: "暂未开放",
        showCancel:false,
        success (res) {
          if (res.confirm) {
            
          } else if (res.cancel) {
            
          }
        }
      })
    }
    
  },
  
  strToUtf8Bytes(str) {
  const utf8 = [];
  for (let ii = 0; ii < str.length; ii++) {
    let charCode = str.charCodeAt(ii);
    if (charCode < 0x80) utf8.push(charCode);
    else if (charCode < 0x800) {
      utf8.push(0xc0 | (charCode >> 6), 0x80 | (charCode & 0x3f));
    } else if (charCode < 0xd800 || charCode >= 0xe000) {
      utf8.push(0xe0 | (charCode >> 12), 0x80 | ((charCode >> 6) & 0x3f), 0x80 | (charCode & 0x3f));
    } else {
      ii++;
      // Surrogate pair:
      // UTF-16 encodes 0x10000-0x10FFFF by subtracting 0x10000 and
      // splitting the 20 bits of 0x0-0xFFFFF into two halves
      charCode = 0x10000 + (((charCode & 0x3ff) << 10) | (str.charCodeAt(ii) & 0x3ff));
      utf8.push(
        0xf0 | (charCode >> 18),
        0x80 | ((charCode >> 12) & 0x3f),
        0x80 | ((charCode >> 6) & 0x3f),
        0x80 | (charCode & 0x3f),
      );
    }
  }
  //兼容汉字，ASCII码表最大的值为127，大于127的值为特殊字符
  for(let jj=0;jj<utf8.length;jj++){
	  var code = utf8[jj];
	  if(code>127){
		  utf8[jj] = code - 256;
	  }
  }
  return utf8;
},

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    let self=this
    let userinfo = wx.getStorageSync('userinfo');
    let code = options.OrgCode;
    let name = options.orgName;
    // let newName=this.strToUtf8Bytes(name)
    // console.log('测试newName',newName);
    let type = options.componentType;
    let isLogin = options.isLogin;
    let flag = true;
    console.log('isLogin',isLogin);
    if(isLogin == "0"){
      flag = false
    }
    wx.setStorageSync('qrcodeInfo', options)
    this.setData({
      code:String(code),
      name: name,
      type: type,
      userinfo:userinfo
    })
    console.log('userinfo-------',userinfo);
    if(userinfo){
      console.log("-------->",type)
      // login().then(_=>{
        this.setData({
          loginFlag: true
        })
        if(isLogin !=0){
          this.newCheckUser()
        }
        
        //判断游客 走游客check接口
        // if(userinfo.userType == "4"){
        //   this.checkRegister1()
        // }

        //企业自招入口
        // if(type == 1){
        //   if(code == undefined || code == "undefined"){ //搜索进入check
        //     this.checkRegister(userinfo.componentCode,"");
        //   }else{ //扫码进入check
        //     this.checkRegister(code,"");
        //   }
        // }
         //劳务公司劳务工入口
        // if(type == 0){
        //   console.log("code=======>",code)
        //   if(code == undefined || code == "undefined"){//搜索进入check
        //     this.checkRegister(userinfo.componentCode,userinfo.labourCode);
        //   }else{ //扫码进入check
        //     if(isLogin == 0){
        //       this.checkRegister(userinfo.componentCode,userinfo.labourCode);
        //     }else{
        //       let phone = wx.getStorageSync('phoneNumber')
        //       if(phone){
        //         wx.navigateTo({
        //           url: `/pages/register/register?componentType=${this.data.type}&OrgCode=${this.data.code}&orgName=${this.data.name}`,
        //         })
        //       }else{
        //         this.setData({
        //           loginFlag: false
        //         })
        //       }
        //     }
        //   }
        // }
      // }
      // )
    }else{
      //企业自招入口
      // if(type == 1){
      //   this.setData({
      //     loginFlag: false
      //   })
      //   login().then(res =>{
      //     this.checkRegister(this.data.code,"");
      //   })
      // }
      //  //劳务公司劳务工入口
      // if(type == 0){
      //   login()
      // }
      login().then(res =>{ 
        if(isLogin !=0){
          this.newCheckUser()
          
        }
          })
    }
  },
  getZptz(){
    console.log('获取权限');
    wx.requestSubscribeMessage({
      tmplIds: ['opRtEx573VbJ3eKfzXmrY1_CjPnu2CjwTeL-JXGeGB8'],
      success (res) {
        console.log("-------->",res)
      },
      fail(err){
        console.log("-------->",err)
      }
    })
  },
  getMessage(){
    console.log('获取权限');
    wx.requestSubscribeMessage({
      tmplIds: ['8Dqe1JDHYbv4SP4bGBgIL6a9oS9RIbQlkOaqGt0QNUw','kPrOW5nKcf2_gYzpUkn_HX_O3lIzfCmExMfCKHvvjU8','DGwA_Pjnj3T9VEB7Y1Dv_g2L6GoF-5-120UqVurqDKI'],
      success (res) {
        console.log("-------->",res)
      },
      fail(err){
        console.log("-------->",err)
      }
    })
  },
  newLogin(params){
    Toast.loading({
      duration: 0,
      message: '登录中...',
      forbidClick: true,
    });
    let self = this;
    wx.request({
      url: `${ApiRootUrl}/index/newLogin`,
      method: 'POST',
      header: {
        'content-type': 'application/json; charset=utf-8',
        'cookie': wx.getStorageSync("sessionid")
      },
      data:params,
      success(res) {
        Toast.clear();
        if(res.data.code == 20000){
         wx.setStorageSync('userinfo', res.data.data)
        }else{
         
          Toast({
            duration: 3000,
            forbidClick: true,
            type: 'fail',
            message: res.data.message,
          });
        }
      },
      fail(res){
        Toast.clear();
        Toast({
          duration: 3000,
          forbidClick: true,
          type: 'fail',
          message: '网络已断开',
        });
      }
    })
  },
  checkRegister1() {
    let self = this;
    let openId = wx.getStorageSync("openId");
    let url = `${ApiRootUrl}/index/checkAppRegisterUser/${openId}`;
    // Toast.loading({
    //   message: '加载中...',
    //   mask: true,
    //   duration: 0,
    //   forbidClick: true,
    // });
    wx.showLoading({
      title: '加载中...',
    })
    wx.request({
      url: url,
      method: 'GET',
      header: {
        'content-type': 'application/json; charset=utf-8',
        'cookie': wx.getStorageSync("sessionid")
      },
      success(res){
        // Toast.clear();
        wx.hideLoading()
        console.log("res====>",res)
        if (res.data.code == 20000) {
          let data = res.data.data;
          wx.setStorageSync('userinfo', res.data.data)
          console.log("data.user===>", data)
          // 无user表示是劳务工
          if (!data.user) {
            
          } else {
            // 有user表示是非劳务工
            if (data.user.typeCode == 'business') {
              wx.redirectTo({
                url: '/pages/companyfirstpage/companyfirstpage',
              })
            } else if (data.user.typeCode == 'labour') {
              wx.redirectTo({
                url: '/pages/laborcompany/firstpage/firstpage',
              })
            }
          }
          console.log("接口返回数据：", res.data.data)
        } else if (res.data.code == 30000) {
          
        } else if (res.data.code == 30002) {
          
        } else {
          Toast({
            duration: 3000,
            forbidClick: true,
            type: 'fail',
            message: res.data.message,
          });
        }
      },
      fail(res) {
        wx.hideLoading()
        Toast({
          duration: 3000,
          forbidClick: true,
          type: 'fail',
          message: '网络已断开',
        });
      }
    })
  },
  toAnswer(){
    wx.navigateTo({
      url: '/pages/answer/index/index?type=0'
    })
  },
  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {
    let userinfo = wx.getStorageSync('userinfo');
    if(userinfo){
      this.setData({
        loginFlag: true
      })
    }
  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {

  }
})